package com.expressage.controller;

import com.expressage.po.Send;
import com.expressage.service.PostService;
import com.expressage.service.SendService;
import com.expressage.vo.PostInfo;
import com.expressage.vo.SendInfo;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 公司控制器
 */
@Controller
@RequestMapping("/japafter")
public class CompanyController {

    Logger logger = Logger.getLogger(CompanyController.class);

    @Autowired
    PostService postService;
    @Autowired
    SendService sendService;

    @RequestMapping("/companystaff")
    public String toCharts(){
        logger.info("进入了图表显示控制器");
        return "jspafter/chartstat";
    }

    @RequestMapping("/chartfirst")
    @ResponseBody
    public List<PostInfo> charts(){
        logger.info("视图显示控制器");
        List<PostInfo> list = postService.findStatPie();
        return list;
    }

    @RequestMapping("/chartsecond")
    @ResponseBody
    public List<SendInfo> chartecond (){
        logger.info("视图显示控制器");
        List<SendInfo> list = sendService.findStatPie();
        return list;
    }

    @RequestMapping("/chartthree")
    @ResponseBody
    public Map<String,List> chartThree(){
        Map<String,List> map= postService.findStatBar();
        return map;
    }

    @RequestMapping("/chartfour")
    @ResponseBody
    public Map<String,List> chartFour(){
        Map<String,List> map= sendService.findStatBar();
        return map;
    }
}
